<template>
  <div class="child">
      <h2>子组件2</h2>
      <h3>书籍：{{ book }}</h3>
      <h3>电脑：{{ computer }}</h3>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
const computer = ref('联想')
const book = ref('红楼梦')

// 把数据暴露给父组件
defineExpose({
  computer,
  book
})
</script>

<style scoped>
.child {
  padding: 10px;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  background-color: skyblue;
  border-radius: 10px;
}
</style>